<template>
  <div class="tabs">
    <div
      v-for="item in tabs"
      :class="{ check: item.id === activeTab }"
      :key="item.id"
      @click="emit('changeTab', item)"
    >
      <span>{{ item.title }}</span>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps(["tabs", "activeTab"]);
const emit = defineEmits(["changeTab"]);
</script>

<style scoped>
.tabs {
  width: 100%;
  height: 1.2rem;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.32rem;
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.tabs .check {
  color: var(--theme-neutral1);
  background: #fd66b1;
}
.tabs div {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #7c5a86;
  font-size: 0.44rem;
  background: #40294f;
  font-weight: 700;
  position: relative;
  border-radius: 0.3rem;
  transition: all 0.2s;
}
</style>
